package com.ichengzi.audit.human.manage;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

/**
 * kafka 消费者
 *
 * @author zmz
 * @since 2023-10-12
 */

@Component
public class KafkaConsumer {

    private final Logger logger = LoggerFactory.getLogger(KafkaConsumer.class);

    /**
     * kafka 消费者监听
     * @author zmz
     * @since 2023-10-12 012
     * @param record 消费者对象
     */
    @KafkaListener(topics = "test_topic",groupId = "group.demo")
    public void onNormalMessage(ConsumerRecord<String, Object> record) {
        logger.info("消息接收.......");
        logger.info("topic=" + record.topic() + ",value=" + record.value());
    }

}
